package mse.eai.jbpm.dailyDigestProcess;

import java.util.Map;
import java.util.Map.Entry;

import org.jbpm.graph.def.ActionHandler;
import org.jbpm.graph.exe.ExecutionContext;

public class PrepareDigest implements ActionHandler {

	@Override
	public void execute(ExecutionContext context) throws Exception {

		System.out.println("------------- PREPARE DIGEST --------------------");
		
		
		Map<Integer,String> mapOfEmails = (Map<Integer,String>) context.getVariable("MapOfEmails");
		Integer uid = (Integer) mapOfEmails.entrySet().iterator().next().getKey();
		String email = mapOfEmails.get(uid);
		
		context.setVariable("uid", uid);
		context.setVariable("subject", "PhaseBook Daily Digest");
		context.setVariable("message", email);
		
	
		
		
		System.out.println("----------------------------------");
		
		context.leaveNode();
		
		
	}

}
